//
//  ViewController.m
//  FirstItem
//
//  Created by Mango on 16/7/1.
//  Copyright © 2016年 孟锦翔. All rights reserved.
//

#import "ViewController.h"
#import "AudioViewController.h"
#import "VideoViewController.h"


@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UITableView * tableView;

@property(nonatomic,copy)NSMutableArray * dataSource;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //Faker01  无敌
    // EEEEEEason_X 逗比
    //JackMeng 逗比
    
    self.view.backgroundColor = [UIColor colorWithRed:0.98 green:0.94 blue:0.94 alpha:1.00];

    [self createButton];
}

- (void)createButton {
    UIButton * button = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
    [button setBackgroundImage:[UIImage imageNamed:@"魔兽2.jpg"] forState:UIControlStateNormal];
    [self.view addSubview:button];
}

    
    
    /**
     *  Faker01
     *
     *  @return 无敌
     */
    
    /**
     *  EEEEEEason_X
     *
     *  @return 逗比
     */
    
    /**
     *  JackMeng
     *
     *  @return 逗比
     */
    
    
    
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataSource.count;
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"reuseID"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"reuseID"];
    }
    cell.textLabel.text = self.dataSource[indexPath.row];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 0) {
        AudioViewController * audio = [[AudioViewController alloc]init];
        [self.navigationController pushViewController:audio animated:YES];
    }else {
        VideoViewController * video = [[VideoViewController alloc]init];
        [self.navigationController pushViewController:video animated:YES];
    }
    
}


-(UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 375, 664-64-49)style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        
        //给tableview添加尾视图 可以消除多余的没有数据的显示的行
        UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 10)];
        _tableView.tableFooterView = view;
        
    }
    return _tableView;
}


-(NSMutableArray *)dataSource{
    if (!_dataSource) {
        _dataSource = [[NSMutableArray alloc]initWithObjects:@"音频",@"视频" ,nil];
    }
    return _dataSource;
}


>>>>>>> master

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
